package com.vo;

/**
 * 供货商品商品表实体类
 */

import com.bean.ChooseCommodity;



import java.io.Serializable;

public class CommodityVo implements Serializable {
    /*主键*/
    private String id;
    /*类型*/
    private String type;
    /*名字*/
    private String name;
    /*商品进价*/
    private String price;
    /*商品库存*/
    private String amonut;
    /*描述*/
    private String describes;
    /*供货商id*/
    private String providerId;

    public CommodityVo() {
    }

    public CommodityVo(String id, String type, String name, String price, String amonut, String describes, String providerId) {
        this.id = id;
        this.type = type;
        this.name = name;
        this.price = price;
        this.amonut = amonut;
        this.describes = describes;
        this.providerId = providerId;
    }

    public ChooseCommodity parse(){

        ChooseCommodity chooseCommodity = new com.bean.ChooseCommodity();

        try {
            chooseCommodity.setId(Integer.valueOf(this.id));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            chooseCommodity.setType(Integer.valueOf(this.type));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            chooseCommodity.setProviderId(Integer.valueOf(this.providerId));
        } catch (Exception e) {
//            e.printStackTrace();
        }

        try {
            chooseCommodity.setAmonut(Integer.valueOf(this.amonut));
        } catch (Exception e) {
//            e.printStackTrace();
        }


        try {
            chooseCommodity.setPrice(Double.valueOf(this.price));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        chooseCommodity.setName(this.name);
        chooseCommodity.setDescribes(this.describes);

        return chooseCommodity;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getAmonut() {
        return amonut;
    }

    public void setAmonut(String amonut) {
        this.amonut = amonut;
    }

    public String getDescribes() {
        return describes;
    }

    public void setDescribes(String describes) {
        this.describes = describes;
    }

    public String getProviderId() {
        return providerId;
    }

    public void setProviderId(String providerId) {
        this.providerId = providerId;
    }

    @Override
    public String toString() {
        return "CommodityVo{" +
                "id='" + id + '\'' +
                ", type='" + type + '\'' +
                ", name='" + name + '\'' +
                ", price='" + price + '\'' +
                ", amonut='" + amonut + '\'' +
                ", describes='" + describes + '\'' +
                ", providerId='" + providerId + '\'' +
                '}';
    }
}
